hp2xx [-options] [hpgl-file(s)]
Option Format Default Description ------------------------------------------------------------------------- General options: -f char * "" Name of output file (default: stdout) -m char * pcl Mode. Valid: mf,ps, pcl,pcx,atari, vga (DOS only) -p int 1 Pensize [dots] (PCL,PCX,VGA), [1/10 mm] (mf, ps). Valid: 1-4 -q off Quiet mode. No diagnostic output. -r double 0.0 Rotation angle [deg]. -r90 gives landscape -s char * hp2xx.swp Name of swap file Size controls: -a double 1.0 Aspect factor. Valid: > 0.0 -h double 100 Height [mm] of picture -w double - Width [mm] of picture. If given, overrides -h -x double - Preset xmin value of HPGL coordinate range -X double - Preset xmax value of HPGL coordinate range -y double - Preset ymin value of HPGL coordinate range -Y double - Preset ymax value of HPGL coordinate range Raster format controls: -d int 75 DPI value (x or both x&y) -D int 75 DPI value (y only) PCL only: -F off Send a FormFeed after graphics data -i off Pre-initialize printer -S off Use (Deskjet) Special commands -o double 0.0 x offset [mm] of picture (left margin) -O double 0.0 y offset [mm] of picture (upper margin) -d (see above) Valid ONLY 300, 150, 100, 75 -D (see above) INVALID for PCL! PS and PCL: -o double 0.0 x offset [mm] of picture (left margin) -O double 0.0 y offset [mm] of picture (upper margin) VGA (on PCs) only: Hi-Res mode setups: -V int 18 VGA mode byte (decimal) -W int 640 VGA pixel width. ------------------------------------------------------------------------- -H Show help.
hp2xx reads HPGL ASCII source files, interprets them, and converts them into either another vector-oriented format or one of several rasterfile formats. Currently, its HPGL parser only recognizes a small subset of the HP 7475 command subset, basically the absolute or relative Move or Draw commands, so don't expect fancier stuff like circles / text output / filled polygons. Since it only processes simple vectors, its output can be easily adapted to many formats.
hp2xx reads from stdin or from a file if any given on the command line. You may specify more than one input file (if this makes sense at all). The output is written to stdout by default. Use option -f outfile to specify your output file name, or just use output redirection (DOS users beware: DOS limits output redirection to ASCII data only, so -f is preferred). The program scans the current HPGL source, writes all vectors in internal binary format into a temporary file, and concurrently determines the maximal coordinate range. It then processes the vectors by mapping them into a new coordinate system with a height of 100mm by default exactly covering the detected y range, and by preserving the aspect ratio of the original data. Use option -h height to set the desired height of your output picture; optionally use -a aspectfactor to alter the aspect ratio by the given factor (aspectfactor < 1 narrows your picture). Alternatively, specify the desired picture width using -w width. The height will then be automatically generated, as will be the width if you control the picture's heigth. Please note that -w overrides any -h option! Option -r rotation_angle (in degrees) allows you to rotate the object prior to all scaling operations. Its main use is to facilitate landscape format: -r90 rotates your whole picture, e.g. from portait to landscape format. However, any reasonable rotation angle is valid. If you need to process a series of similar objects which should be translated into exactly the same coordinate system, there is a way to override the auto-scaling: First, run all files separately and note the infos on the used coordinate ranges. Then, pick a range that will cover ALL your pictures. You can now assign defaults to the internally generated range limits by specifying -x xmin, -X xmax, -y ymin, and -Y ymax. NOTE: Clipping is NOT supported! If any picture coordinate exceeds your limits, they will be overwritten. Use option -m mode to select the program mode, i.e. the output format. Currently supported: mode = "mf" (Metafont), "ps" (PostScript), "pcl" (HP-PCL Level 3 format, suitable for printing on a HP Laserjet II, DeskJet, or compatible printer), "atari" (ATARI screen format), or "pcx" (PC-Paintbrush format, also accepted by MS-Paintbrush / Windows 3.0 and many other PC based pixel renderers). On PC's, there also is a preview option "vga" which supports VGA cards ONLY. Default mode is pcl. If you use a raster format, the picture is rasterized by default into a 75 DPI resolution image. Use option -d DPI_value to change the resolution, e.g. -d300 will cause a HP LJ-II compatible 300 dpi rasterization. There is a way of specifying a different resolution for y direction: -D DPI_y_value, although it is of limited use yet. It is intended for, e.g., support of NEC P6 printers (360x180 DPI) and alike in a later release. If processing large pictures at high resolution on low-memory machines, typically under DOS, the program may start swapping. Opionally change the swap file by using -s swapfile, e.g. to speed up processing by swapping to a RAM disk.
Currently, two vector formats are supported: TeX/Metafont and -I PostScript. Use -m mf to convert a HPGL drawing into a Metafont character to be included into a TeX document as the character "Z" of a special font that you may create. Edit the metafont source, e.g., to change the letter "Z" for another, or to change the line thickness, which is set to 0.4pt by default. Use option -p pensize for a limited control over pensize: The actual Metafont pensize will be "pensize * 0.1 mm", with pensize = 1, 2, 3, or 4. The same applies to -m ps, the PostScript mode. Here, you also need to use options -o and -O (see below) for proper margins in paper since hp2xx puts your picture "flush" to the left and upper paper limit by default.
The following formats are supported: HP-PCL, PCX, ATARI, and VGA (preview on PC's). However, generation of other formats is made easy for programmers because of hp2xx's modular structure. The program allocates a bitmap on a line-by-line basis, swapping lines to disk if needed, and plots into this bitmap. Depending on the selected format, a conversion module is then activated, which might easily be replaced by other converters. Add more formats if you like! Option -p pensize controls the size (in pixels) of the virtual plotting pen. The only implemented shape of the pen tip is a square of the given length. Default pen size is 1. Specifying -p4 when in 75 DPI mode will make pretty clumsy pictures, while you may prefer -p2 over -p1 when in 300 DPI. PCX: The size of a PCX picture is controlled via its specified height and the current DPI value. To create a high-resolution PCX image, just increase the DPI value as desired. PCX format does not accept offsets. ATARI: ST screens (640x400 pixels) can easily be dumped to files. Many programs accept graphics by including these screen dump files. Graphics filling more than one screenful may be split into screen-size blocks and loaded/mounted blockwise. hp2xx converts to ATARI screen format by trying to fit the resulting picture into a single screen equivalent (max. 400 rows, max. 80 Bytes (640 pixel) per row). If it succeeds, hp2xx produces a single output file. Specify ONLY its base name (option -f), since hp2xx adds the file extension ".000". However, if more screen blocks are required horizontally and/or vertically, hp2xx will automatically split the picture into files with extensions ".001" / ".010" to a maximum of ".999" in a matrix-like fashion: Extension ".rrc" indicates a block at row position rr and column position c, counting from 0. The picture is padded with background color at its right and lower margins, if needed. File compression is not supported yet. -- By setting DPI and height/width, you implicitely have control over the resulting scan lines or columns. E.g., leaving DPI at its default (-d 75), and specifying a height of 135mm (-h 135), you'll get 400 rows. PCL: HP-PCL Level 3 format, most useful for direct printer output. Due to this action, there have been added some extra flags and options: Use flag -i to send a printer initialization sequence before the actual image. Flag -F adds a Form Feed (FF, hex 0C) after the image is completed, which is what you may want most of the time. However, overlay printing of several files is feasible by omitting -F. For additional control of the picture's final position on paper, you may add x or y offsets using -o X_offset or -O Y_offset. E.g., -o 20 -O 30 will give you 30 mm additional top margin and 20 mm additional left margin. For DeskJet / DeskJet-plus / DeskJet 500 printers, there are some special printer commands. Activate them with flag -S.
% hp2xx -m pcx -f my_output.pcx -d300 -p2 -h50 -a 1.2 my_input.hp creates a PCX file at 300 DPI of height 50 mm, using an aspect factor of 1.2 and a pen size of 2 pixels. % my_hpgl_generator | hp2xx -o20 -O30 -F -q | lpr -P my_PCL_printer HPGL output is piped through hp2xx; the resulting PCL code is piped to the printer queue, giving an image of height 100 mm at 75 DPI. An additional left margin of 20mm and upper margin of 30mm is created. A formfeed will be added (handy if your printer queue does not). % hp2xx -m vga my_input.hp (PC only): Preview on VGA screen.
Heinz W. Werntges, Biokybernetik, Geb. 26.12, Heinrich-Heine-Universitaet,
D-4000 Duesseldorf 1, Germany. Internet: heinz@biokyb.uni-duesseldorf.de
The number of ignored and/or unknown HPGL commands is given. You will be informed if swapping starts. Progress is indicated by output of dots, each dot representing 10 move/draw commands during scanning and plotting, or 10 scan lines during output. Shut off diagnostic output by specifying -q (quiet mode).